import Vue from "vue";
import VueRouter from "vue-router";
import pageHome from "@/views/pageHome/pageHome.vue";
// import Welcome from "@/views/welcome/welcome.vue";

Vue.use(VueRouter);

const constantRoutes = [
  {
    path: "/",
    name: "pageHome",
    component: pageHome
  },
  {
    path: "/home",
    name: "home",
    component: () =>
      import(/* webpackChunkName: "home" */ "@/views/home/home.vue")
  },
  {
    path: "/login",
    name: "login",
    component: () =>
      import(/* webpackChunkName: "login" */ "@/views/login/login.vue")
  },
  {
    path: "/pageHub",
    name: "pageHub",
    component: () =>
      import(/* webpackChunkName: "pageHub" */ "@/views/pageHub/pageHub.vue")
  },
  {
    path: "/discountTicketHome",
    name: "discountTicketHome",
    meta: {
      title: "固定主页",
      keepAlive: true
    },
    component: () =>
      import(
        /* webpackChunkName: "discountTicketHome" */ "@/views/projectTypes/discountTicket/discountTicketHome.vue"
        ),
    children: [
      {
        path: "/discountTicketIndex",
        name: "discountTicketIndex",
        meta: {
          title: "功能主页",
          keepAlive: true
        },
        component: () =>
          import(
            /* webpackChunkName: "discountTicketIndex" */ "@/views/projectTypes/discountTicket/disTicPages/discountTicketIndex.vue"
            )
      },
      {
        path: "/discountTicketOther",
        name: "discountTicketOther",
        meta: {
          title: "其他页面",
          keepAlive: true
        },
        component: () =>
          import(
            /* webpackChunkName: "discountTicketOther" */ "@/views/projectTypes/discountTicket/disTicPages/discountTicketOther.vue"
            )
      }
    ]

  }

];

/*const router = new VueRouter({
  mode: "history",  //hash,history
  base: process.env.BASE_URL,
  routes,
});*/

export default new VueRouter({
  mode: "hash",
  scrollBehavior: () => ({ y: 0 }),
  base: process.env.BASE_URL,
  routes: constantRoutes
});

export const asyncRoutes = [{ path: "*", redirect: "/404", hidden: true }];
